package com.myk.game.sumeru.game;

/**
 * 地图上的格子
 */
public class Grid {

    private int type; //0：空地，1：己方洞穴，2：己方村落，5：魔域，8：对方村落，9：对方洞穴
    private int x; //地形所处的列
    private int y;    //地形所处的行

    public Grid top;    //上方的格子
    public Grid bottom; //下方的格子
    public Grid left;   //左侧的格子
    public Grid right;  //右侧的格子

    private Chess chess; //格子上的棋子
    private GridBeClickEvent beClickEvent; //格子被点击事件

    public Grid(int type, int x, int y) {
        this.type = type;
        this.x = x;
        this.y = y;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public Chess getChess() {
        return chess;
    }

    public void setChess(Chess chess) {
        this.chess = chess;
    }

    public void setBeClickEvent(GridBeClickEvent beClickEvent) {
        this.beClickEvent = beClickEvent;
    }

    public void notifyBeClickEvent() {
        if (beClickEvent != null) {
            beClickEvent.beClickEvent();
        }
    }

    public interface GridBeClickEvent {
        void beClickEvent();
    }
}
